'use strict';

const  mysql=require('../../utils/query.js')
const Service = require('egg').Service;

class equipmentService extends Service {
    async findall() {
        console.log('EquipmentService======>findall()');
        //this.app.mysql.select报错，提示select 未被定义
        const data = await mysql.query('select * from e_instrument');
        console.log(data);
        return data;
        connection.end();
    }
    async updateById() {
        console.log('EquipmentService======>updateById()');
       const data = await mysql.query("UPDATE e_instrument SET NAME='LED中控制屏',manufactor='纳米软件' WHERE id =6");
        console.log(data);
        connection.end();
    }
    async insertEquip() {
        console.log('EquipmentService======>insertEquip()');
        const data = await mysql.query("INSERT INTO e_instrument(NAME,TYPE,manufactor,model) VALUES('测汞仪',3,'安泰','实验室仪器')");
        console.log(data);
        connection.end();
    }
    async deleteById() {
        console.log('EquipmentService======>deleteById()');
        const data = await mysql.query('DELETE FROM e_instrument WHERE id=10');
        console.log(data);
        connection.end();
    }
}
module.exports = equipmentService;